According to general image compression standards, image data is compressed by partitioning a frame into a plurality of block units, performing prediction on each block unit to obtain a predicted block, and transforming and quantizing a difference between the original image block and the predicted block.
A prediction method includes intra prediction and inter prediction. According to intra prediction, a current block is predicted using data of adjacent blocks in a current frame. According to inter prediction, a predicted block corresponding to a current block is generated from one or more previously encoded reference frames by using block-based motion compensation. Each block is encoded by encoding the block in all coding modes usable for intra prediction and inter prediction, and then determining an optimal coding mode based on a bitrate required to encode the block, and a distortion between an original block and a decoded block.